namespace Crux.Core.Websockets;
/// <summary>
/// GroupProxy
/// </summary>
internal class GroupProxy(ILifetimeManager lifetimeManager) : IGroupProxy
{
    /// <summary>
    ///
    /// </summary>
    private readonly ILifetimeManager _manager = lifetimeManager ?? throw new ArgumentNullException(nameof(lifetimeManager));
    /// <summary>
    ///
    /// </summary>
    /// <param name="connectionId"></param>
    /// <param name="groupName"></param>
    /// <param name="cancellationToken"></param>
    /// <returns></returns>
    public Task AddToGroupAsync(
        string connectionId,
        string groupName,
        CancellationToken cancellationToken = default)
        => _manager.AddToGroupAsync(connectionId, groupName, cancellationToken);
    /// <summary>
    ///
    /// </summary>
    /// <param name="connectionId"></param>
    /// <param name="groupName"></param>
    /// <param name="cancellationToken"></param>
    /// <returns></returns>
    public Task RemoveFromGroupAsync(
        string connectionId,
        string groupName,
        CancellationToken cancellationToken = default)
        => _manager.RemoveToGroupAsync(connectionId, groupName, cancellationToken);
}
